package com.czk.variabledeployment;

import com.czk.pojo.Holiday;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;

/**
 * @Author ChenZhangKun
 * @Date 2020/9/15 10:24
 */
public class SetVariablByInstanceId {
    public static void main(String[] args) {
        // 拿到部署引擎
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        // 拿到runtimeService
        RuntimeService runtimeService = processEngine.getRuntimeService();
        //
        Holiday holiday=new Holiday();
        holiday.setNum(2f);
        // 设置流程变量
        runtimeService.setVariable("107501","holiday",holiday);
    }
}
